import 'package:flutter/material.dart';

class CustomScrollViewPageII extends StatefulWidget {
  const CustomScrollViewPageII({Key? key}) : super(key: key);

  @override
  State<CustomScrollViewPageII> createState() => _CustomScrollViewPageII();
}

class _CustomScrollViewPageII extends State<CustomScrollViewPageII> {
 
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xFFF4F5F7),
      body: CustomScrollView(
        // 反弹效果
        physics: BouncingScrollPhysics(),
        slivers: [
          SliverAppBar(
            title: Text("组合滑动"),
          ),
          SliverPadding(padding: EdgeInsets.all(5)),
          // 九宫格
          SliverGrid(
            delegate: SliverChildBuilderDelegate((BuildContext context,num index){
              return Container(
                color: Colors.blue,
                child: Text("grid $index"),
              );
            },
            childCount: 10
            ), 
            gridDelegate:SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 3, // 九宫格的列数
              childAspectRatio: 2.0, // ziWidget 宽与高的比例
              mainAxisSpacing: 20, // 间距
              crossAxisSpacing: 10 // 上下间距
              )
            ),
            SliverPadding(padding: EdgeInsets.all(5)),
            SliverFixedExtentList(
              delegate: SliverChildBuilderDelegate((BuildContext context,num index){
                return Container(color: Colors.red,child: Text("list $index"),);
              },childCount: 40), 
              itemExtent: 40)
        ],
      )
    );
    
  }
}